package com.study.meituan.adapter;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.nostra13.universalimageloader.core.ImageLoader;
import com.study.meituan.entity.CaiDanLeiBieEntity;
import com.study.meituan.R;

import android.content.Context;
import android.opengl.Visibility;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

public class CaiDanLeiBieAdapter extends BaseAdapter {

	private Context context;
	private LayoutInflater inflater;
	private List<CaiDanLeiBieEntity> mlist;
	String TAG = "AdapterCAidanleibie";

	public CaiDanLeiBieAdapter(Context context, List<CaiDanLeiBieEntity> mlist) {

		this.context = context;
		this.mlist = mlist;
		inflater = LayoutInflater.from(context);
	}

	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return mlist.size();
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return position;
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return position;
	}

	static class ViewHolder {
		public ImageView icon;
		public TextView title;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub

		convertView = inflater.inflate(R.layout.cai_dan_lei_bie, null);
		TextView a = (TextView) convertView.findViewById(R.id.name_leibie);
		a.setText(mlist.get(position).getLei_bie());
		ImageView b = (ImageView) convertView.findViewById(R.id.icon);
		b.setBackgroundResource(mlist.get(position).getIcon());
		return convertView;
	}
}
